package 对象;

public class PhoneTest {
    public static void main(String[] args){
        //定义数组来储存三部手机
        Phone[] p = new Phone[3];
        Phone p1 = new Phone("小米" , 1499,"黄色");
        Phone p2 = new Phone("华为" , 7499,"白色");
        Phone p3 = new Phone("真我" , 3499,"绿色");
        p[0] = p1;
        p[1] = p2;
        p[2] = p3;
        for (int i = 0; i < p.length; i++) {
            System.out.println( p[i].getPp() + " " +p[i].getPrice() + " " + p[i].getColor());
        }
        double result = ( p[0].getPrice() + p[1].getPrice() + p[2].getPrice() ) /p.length ;
        System.out.println("三台手机的平均价格为： " + result + "元");
    }
}
